<template>
  <div id="app">
    <Essheader></Essheader>
    <router-view v-if="isRouterAlive"></router-view>
    <!-- elementUI 回顶部 -->
    <el-backtop>
      <div class="toup">
        <img src="@/assets/images/toup.png" alt="" />
      </div>
    </el-backtop>
    <Essfooter></Essfooter>
  </div>
</template>

<script>
import Essheader from "@/components/pulic/Essheader.vue";
import Essfooter from "@/components/pulic/Essfooter.vue";

export default {
  components: {
    Essheader,
    Essfooter
  },
  provide() {
    //父组件中通过provide来提供变量，在子组件中通过inject来注入变量。
    return {
      reload: this.reload
    };
  },
  data() {
    return {
      isRouterAlive: true //控制视图是否显示的变量
    };
  },
  created() {},
  methods: {
    reload() {
      this.isRouterAlive = false; //先关闭，
      this.$nextTick(function() {
        this.isRouterAlive = true; //再打开
      });
    }
  }
};
</script>

<style>
body {
  margin: 0;
  padding: 0;
  background: #ffffff;
}
a {
  text-decoration: none;
  text-align: center;
  font-size: 15px;
  color: #2b57a2;
  letter-spacing: 1px; /*字间距*/
}
a:hover,
a:active,
a:hover,
a:active {
  color: #2b56a1;
}
/* show-overflow-tooltip宽度 */
.el-tooltip__popper {
  max-width: 30%;
}
.toup {
  width: 50px;
  height: 50px;
}
.toup img {
  width: 50px;
  height: 50px;
}
</style>
